home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
util
/
text
/
xes.lha
/
XES
/
REXX
/
MultiFiles.xdme
< prev
next >
Wrap
Text File
|
1995-08-01
|
5KB
|
155 lines
/* $VER: MultiFiles.xdme 1.0 (01 Aug 1995) */
/* Uses the ReqTools File Requester to delete, crunch,
decrunch, copy, move, print, or load multiple files */
/* Copyright © 1995 Fergus Duniho */
PARSE ARG com .
SELECT
WHEN com = "ViewArc" THEN DO
hailstr = "Select Archives to View"
oktext = "_View"
END
WHEN com = "Unarchive" THEN DO
hailstr = "Select Archives to Extract"
oktext = "_Extract"
END
OTHERWISE DO
hailstr = "Select Files to" com
oktext = "_" || com
END
END
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_multiselect|freqf_patgad"
IF com = "Delete" THEN tagstr = tagstr || "|freqf_selectdirs|freqf_save"
IF com = "Load" THEN tagstr = tagstr "rtfi_matchpat=~(#?.xsrc)"
ADDRESS 'XDME.1'
OPTIONS RESULTS
'rxresult $path'
P = result
'rxresult $fname'
N = result
IF com = "ViewArc" | com = "Unarchive" THEN do
P = "Misc:Archives"
N = ""
end
CALL rtfilerequest(P,N,hailstr,oktext,tagstr,files)
IF files = 0 THEN EXIT
SELECT
WHEN com = "Delete" THEN DO X = 1 TO files.count
CALL Remove files.X
END
WHEN com = "Unpack" THEN DO X = 1 TO files.count
C = 'xpack "' || files.X || '"'
SAY "Unpacking" files.X "..."
ADDRESS Command C
END
WHEN com = "Copy" | com = "Move" THEN DO
IF files.count = 1 THEN DO
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_patgad"
dest = rtfilerequest(P,N,"Select Destination",,tagstr)
END
ELSE DO
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_nofiles"
dest = rtfilerequest(P,,"Select Destination",,tagstr)
END
IF rtresult = 1 THEN DO
DO X = 1 TO files.count
C = com '"' || files.X || '" "' || dest || '"'
SAY C
ADDRESS COMMAND C
END
END
END
WHEN com = "Print" THEN DO
D = Request(22,19,"Select Destination", "PRT:", " Print ", " Cancel ")
IF D ~= "" THEN DO
DO X = 1 TO files.count
C = 'Type "' || files.X || '" to "' || D || '"'
SAY C
ADDRESS COMMAND C
END
END
END
WHEN com = "Run" THEN DO X = 1 TO files.count
C = 'runback "' || files.X || '"'
SAY C
ADDRESS COMMAND C
END
WHEN com = "Load" THEN DO X = 1 TO files.count
C = "newwindow chfilename (" || files.X || ") rx REXX:LoadFile"
C
END
WHEN com = "Unarchive" THEN DO
tagstr = "rt_reqpos=reqpos_centerscr rtfi_flags=freqf_nofiles|freqf_save"
dest = rtfilerequest(P,,"Select Destination",,tagstr)
IF rtresult = 1 THEN DO
DO X = 1 TO files.count
tail = Upper(right(files.X, 3))
SELECT
WHEN tail = "LHA" | tail = "LZH" | tail = "RUN" THEN
unarc = 'lha -m -a x "' || files.X || '"' '"' || dest || '"'
WHEN tail = "ZIP" THEN
unarc = 'unzip -o "' || files.X || '"'
WHEN tail = "ZOO" THEN
unarc = 'zoo x./ "' || files.X || '"'
WHEN tail = "LZX" THEN
unarc = 'LZX -m -a x "' || files.X || '"' '"' || dest || '"'
OTHERWISE ITERATE
END
SAY unarc
ADDRESS COMMAND unarc
END
END
END
WHEN com = "ViewArc" THEN DO
CALL Delete 'T:Archives'
DO X = 1 TO files.count
tail = upper(right(files.X, 3))
SELECT
WHEN tail = "LHA" | tail = "LZH" | tail = "RUN" THEN
view = 'lha >>T:Archives v'
WHEN tail = "ZIP" THEN
view = 'unzip >>T:Archives -v'
WHEN tail = "ZOO" THEN
view = 'zoo >>T:Archives -list'
WHEN tail = "LZX" THEN
view = 'LZX >>T:Archives v'
OTHERWISE ITERATE
END
C = 'execute (' || view '"' || files.X || '")'
C
END
'execute (C:runback More T:Archives)'
END
OTHERWISE DO X = 1 TO files.count
C = 'xpack "' || files.X || '" method' com
SAY "Packing" files.X "with" com "compression ..."
ADDRESS COMMAND C
END
END
EXIT
Remove: Procedure
PARSE ARG fname
IF word(statef(fname), 1) = "DIR" THEN DO
CALL Filelist(Pattern(fname), files, , "E")
DO x = 1 TO files.0
CALL Remove files.x
END
END
SAY "Deleting" fname "..."
CALL delete fname
CALL delete fname || ".info"
RETURN
Pattern: Procedure
PARSE ARG dir
IF Right(dir, 1) ~= ":" THEN
pat = dir || "/*"
ELSE
pat = dir || "*"
RETURN pat